import request from '@/utils/request'

// 查询批次列表
export function listBatches(query) {
  return request({
    url: '/qep/production/batch/list',
    method: 'get',
    params: query
  })
}

// 查询批次详细信息
export function getBatch(id) {
  return request({
    url: '/qep/production/batch/' + id,
    method: 'get'
  })
}

// 新增批次
export function addBatch(data) {
  return request({
    url: '/qep/production/batch',
    method: 'post',
    data: data
  })
}

// 修改批次信息
export function updateBatch(data) {
  return request({
    url: '/qep/production/batch',
    method: 'put',
    data: data
  })
}

// 删除批次
export function delBatch(id) {
  return request({
    url: '/qep/production/batch/' + id,
    method: 'delete'
  })
}

// 查询工序流转记录列表
export function listProcessFlows(query) {
  return request({
    url: '/qep/production/process/flow/list',
    method: 'get',
    params: query
  })
}

// 查询工序流转记录详细
export function getProcessFlow(id) {
  return request({
    url: '/qep/production/process/flow/' + id,
    method: 'get'
  })
}

// 新增工序流转记录
export function addProcessFlow(data) {
  return request({
    url: '/qep/production/process/flow',
    method: 'post',
    data: data
  })
}

// 修改工序流转记录
export function updateProcessFlow(data) {
  return request({
    url: '/qep/production/process/flow',
    method: 'put',
    data: data
  })
}

// 删除工序流转记录
export function delProcessFlow(id) {
  return request({
    url: '/qep/production/process/flow/' + id,
    method: 'delete'
  })
}

// 获取工序效率统计数据
export function getProcessEfficiency(params) {
  return request({
    url: '/qep/production/process/efficiency',
    method: 'get',
    params: params
  })
}

// 获取瓶颈工序分析
export function getBottleneckAnalysis(params) {
  return request({
    url: '/qep/production/process/bottleneck',
    method: 'get',
    params: params
  })
}

// 获取生产周期分析
export function getProductionCycleAnalysis(params) {
  return request({
    url: '/qep/production/cycle/analysis',
    method: 'get',
    params: params
  })
}

// 获取生产进度数据
export function getProductionProgress(params) {
  return request({
    url: '/qep/production/progress',
    method: 'get',
    params: params
  })
}

// 批次追溯
export function traceBatch(batchCode) {
  return request({
    url: '/qep/production/batch/trace/' + batchCode,
    method: 'get'
  })
}

// 导出批次报表
export function exportBatchReport(query) {
  return request({
    url: '/qep/production/batch/export',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
} 